package com.cqjtu.education.utils;

import org.springframework.stereotype.Component;

import javax.servlet.http.HttpServletResponse;

/**
 * @Author: 冉鹏
 * @Date: 2022/4/23 15:11
 */
@Component
public class Response {
    public void setResponse(HttpServletResponse response, Integer status, String reason) throws Exception {
        response.setStatus(status);
        response.setContentType("application/json");
        response.setCharacterEncoding("UTF-8");
        response.getWriter().write("{\"reason\":" + "\"" + reason + "\"}");
        response.getWriter().flush();
    }
}
